package com.lagou.edu.server;

/**
 * @author 胡益文
 * @since 2021/9/28 19:29
 */
public class HttpProtocolUtil {

    /**
    * 功能描述:请求http200的请求头
     * @author: hyw
     * @return:
     * @since: 2021/9/28 19:30
    */
    public static String getHttpHeader200(long length){
        return "HTTP/1.1 200 OK \n"+
                "Content-Type: text/html;charset=utf-8 \n"+
                "Content-Length: "+length+"\n"+
                "\r\n";
    }

    /**
     * 功能描述:请求http404的请求头
     * @author: hyw
     * @return:
     * @since: 2021/9/28 19:30
     */
    public static String getHttpHeader404(){
        String errorMsg="404";
        return "HTTP/1.1 404 Not Funoud \n"+
                "Content-Type: text/html;charset=utf-8 \n"+
                "Content-Length:"+errorMsg.getBytes().length+"\n"+
                "\r\n"+errorMsg;
    }
}
